====== panelUpdate() ======

''void **panelUpdate**(string //Attribut//, string //Wert//, [string //Person ID//])''

The ''panelUpdate()'' function updates the current subscriber's entry in the serial mail address list.

  * //Attribut//\\ The attribute of the address list entry to be changed. Possible attributes are:
    * ''%%'subgroup'%%'' -- subgrup
    * ''%%'language'%%'' -- Preferred language version (3-digit language abbreviation)
    * ''%%'email'%%'' -- Email address
    * ''%%'email.cc'%%'' -- CC adress(es), multiple addresses separated by comma
    * ''%%'mobile'%%'' -- Cell phone number for SMS
    * ''%%'uid'%%'' -- Unique user ID
    * ''%%'salutation'%%'' -- Salutation (complete)
    * ''%%'title'%%'' -- Academic title
    * ''%%'firstname'%%'' -- First name
    * ''%%'lastname'%%'' -- Last name
    * ''%%'gender'%%'' -- Gender for form of address (''%%''%%'', ''%%'female'%%'', ''%%'male'%%'', ''%%'other'%%'')
    * ''%%'custom1'%%'' to ''%%'custom5'%%'' -- User defined fields
  * //value//\\ the new value for the atribute

  * //Personal ID//\\ Optionally, a person identifier (SERIAL) can be specified for the address entry that is to be updated. If no person identifier is specified, ''panelUpdate()'' updates the address entry of the current participant. 
**Important:** The assignment of the current interview to an address entry is only possible if ...
    * the interview was started via the link in a serial mail or
    * the interview was started automatically after confirmation of an opt-in link.

**Important:** The function ''panelUpdate()'' does __not__ work for address entries that use the privacy mode "anonymous".


===== Example: Change Subgroup =====

In the following example, people who selected the value 2 in the selection question AB01 (e.g. "do not wish to participate") are moved to the "screenout" subgroup.

<code php>
if (value('AB01') == 2) {
  panelUpdate('subgroup', 'screenout');
}
</code>

For more on IF constructions, see the [[:en:create:php-filters]] tutorial.

**Important:** This example only works if the questionnaire was accessed via an individual participation link (in a [[:en:survey:mailing|serial mail]]) or as a result of an opt-in confirmation.


===== Example: Save Referenz =====

In the following example the questionnaire was called with a [[:en:survey:url#mark_a_link_r|reference]] in the link. On page 3, a single opt-in (question identifier "OI01") is used to create an address entry. The following PHP code on page 4 stores the reference in the "Custom 1" field of the new address entry to access it in the following, later interview using ''[[:en:create:functions:panelData]]''.

<code php>
$person = value('OI01');
panelUpdate('custom1', reference(), $person);
</code>

**Warning:** Such a constellation can lead to the cancellation of an intended pseudonymization. Clarify the use of such constructions in advance with the responsible data protection officer.